import Api from "@/api/index.js";
import uploadInstance from "@/utils/Request.js";

//上传头像图片
export const PostFileUserImg = file => {
    return uploadInstance.post(Api.uploadAvatarUrl,{
        file,
        createThumbnail: true
    })
}

//上传封面图片
export const PostFileImg = file => {
    return uploadInstance.post(Api.uploadImgUrl,{
        file,
        createThumbnail: true
    })
}

//预上传视频
export const preUploadVideo = file => {
    return uploadInstance.post(Api.preUploadVideo,{
        fileName: file.fileName,
        chunks: file.chunks
    })
}

//上传视频
export const uploadVideo = file => {
    return uploadInstance.post(Api.uploadVideo,{
        chunkFile: file.chunkData,
        uploadId: file.uploadId,
        chunkIndex: file.chunkNumber -1
    })
}